<template>
  <div class="header">
    <div class="logo">
      <img src="../../../assets/img/head_img/logo.png" alt="" />
    </div>
    <div class="search" @click="toSearch">
      <van-icon name="search" class="icon_logo" />
      <p>请输入商品名称...</p>
    </div>
    <div class="info" v-if="!user">
      <span class="iconfont icon-denglu1" @click="toLogin"> </span>
    </div>
    <div class="info" v-else>
      <span class="iconfont icon-bangzhuzhongxin"> </span>
    </div>
  </div>
</template>

<script>
import { mapState, mapGetters } from "vuex";
export default {
  // name: "header",
  computed: {
    ...mapState(["user"]),
    ...mapGetters(["login"]),
  },
  methods: {
    toSearch() {
      this.$router.push("/search");
    },
    toLogin() {
      this.$router.push("/login");
    },
  },
};
</script>

<style lang="less" scoped>
.header {
  width: 100%;
  height: 82px;
  box-sizing: border-box;
  padding: 0 34px 0 18px;
  background-color: #08dbdb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  .logo {
    width: 64px;
    height: 55px;
    // border: solid 1px pink;
    img {
      width: 64px;
      height: 55px;
    }
  }
  .search {
    width: 550px;
    height: 54px;
    background: #fff;
    border-radius: 27px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 5px;
    .icon_logo {
      font-size: 29px;
      margin-top: -5px;
    }
    p {
      font-size: 27px;
      line-height: 27px;
      color: #686868;
    }
  }
  .info {
    width: 55px;
    height: 54px;
    // border: #f10 solid 1px;
    span {
      font-size: 54px;
      line-height: 54px;
      text-align: center;
      color: #fff;
    }
  }
}
</style>
